

<!-- 加载头文件 -->
<include file="Public/header" />
<script src="__PUBLIC__/children/js/jquery-1.8.3.min.js"></script>
    
    <div class="main">
	
        <div class="mainContent">
            <div class="mainColumn">
                <div class="mainColumnTitle"><p>全部商品</p></div>
            </div>
            <div class="mainTableSide">
                <div class="mainTableLine mainLine1">
                    <input class="selectAll" type="checkbox" style=" float:left; margin-top:23px; margin-left:24px;" /><p>全选</p>
                </div>
                <div class="mainTableLine mainLine2">
                    <p>商品</p>
                </div>
                <div class="mainTableLine mainLine3">
                    <p>参数</p>
                </div>
                <div class="mainTableLine mainLine4">
                    <p>数量</p>
                </div>
                <div class="mainTableLine mainLine5">
                    <p>小计</p>
                </div>
                <div class="mainTableLine mainLine6">
                    <p>操作</p>
                </div>
            </div>
			<foreach name="res" item="vo" key="k">

            <div class="mainTableRow">
                <div class="mainTableLine mainLine1">
                    <input type="checkbox" style=" float:left; margin-top:23px; margin-left:24px;" /><img src="__PUBLIC__/children/images/cart/goodsimg.jpg" width="100" height="120" />
                </div>
                <div class="mainTableLine mainLine2">
                    <div class="contentText">
                    <a href="#">{$vo.name}</a>
                    </div>
                </div>
                <div class="mainTableLine mainLine3">
                    <div class="contentText">
                    <p>颜色：黑色</p>
                    <p>尺码：150cm</p>
                    </div>
                </div>
                <div class="mainTableLine mainLine4">
                    <div class="contentText">
						<a class="numup" style="line-height:30px;">+</a>
						<input id="num" class="num" type="text"  value="{$vo.number}" name="num"/>
						<a style="line-height:30px;" class="numdown">-</a>
						<input type="hidden"  name="id" value="{$vo.p_id}" />
						<input type="hidden"  name="price" value="{$vo.price}" />
						<input type="hidden"  name="price1" value="{$totalcost}" />
						<input type="hidden"  class="totalnumber" name="price2" value="{$totalnum}" />
                    </div>
                </div>
                <div class="mainTableLine mainLine5">
                    <div class="contentText">
						<!-- 商品价格小计 -->
						<p>￥<span class="zongjia">{$vo['price']*$vo['number']}</span>.00</p>
					
                    </div>
                </div>
                <div class="mainTableLine mainLine6">
                    <div class="contentText">
						<a href="{:U('Shopcar/del')}?uid={$vo.p_id}">删除</a>
                    </div>
                </div>
            </div>
		
			</foreach>
			
            
            
            <div class="mainTableSide">
                <div class="mainFunctionRight">
                    <div class="mainFunctionRightText">
                        已选择 <span  class="onespan" style="color:#e13232;">{$totalnum}</span> 件商品总价（不含运费）：<span class="twospan" style=" color:#e13232; font:18px yahei;">￥{$totalcost}.00</span>
                        <!-- <p>已节省：<a>- ￥0.00</a></p> -->
                    </div>
                    <a class="mainFunctionRightButton" href="{:U('sureorder/sureorder')}">去结算</a>
                </div>
            </div>
		 
            <div class="mainColumn">
                <div class="mainColumnTitle"><p>猜你喜欢</p></div>
            </div>
            <div class="showPossibleLike">
            
                <div class="mainBoxbutton" id="moveLeft">
                    <img src="__PUBLIC__/children/images/cart/left.png" />
                </div>
                <div class="showPossibleLikeBox">
                    <ul>
                        <li>
                            <div class="MainLike">
                                <a href="__PUBLIC__/children/goods_detail.html"><img src="__PUBLIC__/children/images/cart/showPic.jpg" /></a>
                                <a href="__PUBLIC__/children/goods_detail.html" class="goods_title">秋季童装时尚新风韩版三件套可爱粉色潮流搭配</a>
                                <p style="color:#ff3333; font:16px yahei; line-height:36px;">￥168.00</p>
                                <p style="color:#3399cc; font:12px yahei;">已有（123）人购买</p>
                            </div>
                        </li>
                        <li>
                            <div class="MainLike">
                                <a href="__PUBLIC__/children/goods_detail.html"><img src="__PUBLIC__/children/images/cart/showPic.jpg" /></a>
                                <a href="__PUBLIC__/children/goods_detail.html" class="goods_title">秋季童装时尚新风韩版三件套可爱粉色潮流搭配</a>
                                <p style="color:#ff3333; font:16px yahei; line-height:36px;">￥168.00</p>
                                <p style="color:#3399cc; font:12px yahei;">已有（123）人购买</p>
                            </div>
                        </li>
                        <li>
                            <div class="MainLike">
                                <a href="__PUBLIC__/children/goods_detail.html"><img src="__PUBLIC__/children/images/cart/showPic.jpg" /></a>
                                <a href="__PUBLIC__/children/goods_detail.html" class="goods_title">秋季童装时尚新风韩版三件套可爱粉色潮流搭配</a>
                                <p style="color:#ff3333; font:16px yahei; line-height:36px;">￥168.00</p>
                                <p style="color:#3399cc; font:12px yahei;">已有（123）人购买</p>
                            </div>
                        </li>
                        <li>
                            <div class="MainLike">
                                <a href="__PUBLIC__/children/goods_detail.html"><img src="__PUBLIC__/children/images/cart/showPic.jpg" /></a>
                                <a href="__PUBLIC__/children/goods_detail.html" class="goods_title">秋季童装时尚新风韩版三件套可爱粉色潮流搭配</a>
                                <p style="color:#ff3333; font:16px yahei; line-height:36px;">￥168.00</p>
                                <p style="color:#3399cc; font:12px yahei;">已有（123）人购买</p>
                            </div>
                        </li>
                        <li>
                            <div class="MainLike">
                                <a href="__PUBLIC__/children/goods_detail.html"><img src="__PUBLIC__/children/images/cart/showPic.jpg" /></a>
                                <a href="__PUBLIC__/children/goods_detail.html" class="goods_title">秋季童装时尚新风韩版三件套可爱粉色潮流搭配</a>
                                <p style="color:#ff3333; font:16px yahei; line-height:36px;">￥168.00</p>
                                <p style="color:#3399cc; font:12px yahei;">已有（123）人购买</p>
                            </div>
                        </li>
                        <li>
                            <div class="MainLike">
                                <a href="__PUBLIC__/children/goods_detail.html"><img src="__PUBLIC__/children/images/cart/showPic.jpg" /></a>
                                <a href="__PUBLIC__/children/goods_detail.html" class="goods_title">秋季童装时尚新风韩版三件套可爱粉色潮流搭配</a>
                                <p style="color:#ff3333; font:16px yahei; line-height:36px;">￥168.00</p>
                                <p style="color:#3399cc; font:12px yahei;">已有（123）人购买</p>
                            </div>
                        </li>
                    </ul>
                </div>
                <div class="mainBoxbutton" id="moveRight">
                    <img src="__PUBLIC__/children/images/cart/right.png" />
                </div>
            </div>
        </div>
     </div>
    
    <!-- 加载尾文件 -->
<include file="Public/footer" />

	
    <script type="text/javascript">
		<!-- 点击++ -->
    	$(".numup").click(function(){
		
			var number = parseInt($(this).next().val())+1;
			var id = $(this).next().next().next().val();
			var price = $(this).next().next().next().next().val();
			var allprice = parseInt(price)*parseInt(number);
			var prices = $(this).parent().parent().next().find("span").text(allprice);
			
			var url = "{:U('Shopcar/addNum')}";
			
				$.ajax({
				   type: "POST",
				   url: url,
				   data: "number="+number+"&id="+id,
				   success: function(msg){
				   
					console.log(msg);
					
				   }
				});
			
		});
			<!-- 点击-- -->
		$(".numdown").click(function(){
			if(parseInt($(this).prev().val())>=2){
				var number = parseInt($(this).prev().val())-1;
				var id = $(this).next().val();
				var price = $(this).next().next().val();
				var allprice = parseInt(price)*parseInt(number);
				var prices = $(this).parent().parent().next().find("span").text(allprice);
				
				var url = "{:U('Shopcar/addNum')}";
				
					$.ajax({
					   type: "POST",
					   url: url,
					   data: "number="+number+"&id="+id,
					   success: function(msg){
					   
						console.log(msg);
						
					   }
					});
			}
		});
		<!-- 总价 总数量 -- -->
		$(".numdown").click(function(){
			if(parseInt($(this).prev().val())>=2){
				var price = $(this).next().next().val();
				var number = parseInt($(this).prev().val())-1;
				var totalcost = $(this).next().next().next().val();
				var totalnum = $(this).next().next().next().next().val();
				var allprice = parseInt(price)*parseInt(number);
				//console.log(totalnum);
				//console.log(allprice);
				//总价计算
				var totalcost = 0;
				$(".zongjia").each(function(index, element) {
				   totalcost = totalcost +  parseFloat($(this).html());
				});
				var totalnum = 0;
				$(".num").each(function(index, element) {
				    totalnum = totalnum +  parseInt($(this).val());
				});
				
				//赋值
				var totalc = $(".twospan").html("￥"+totalcost+".00");
				var totaln = $(".onespan").html(parseInt(totalnum)-1);
				var allnum = $(this).parent().parent().parent().next();
				var url = "{:U('Shopcar/addNum')}";
				
					$.ajax({
					   type: "POST",
					   url: url,
					   data: "number="+number,
					   success: function(msg){
					   
						console.log(msg);
						
					   }
					});
			}
		});
		
		<!-- 总价 总数量 ++ -->
		$(".numup").click(function(){
				
				var price = $(this).next().next().val();
				var number = parseInt($(this).next().val())+1;
				var totalcost = $(this).next().next().next().val();
				var totalnum = $(this).next().next().next().next().val();
				var allprice = parseInt(price)*parseInt(number);
				//console.log(totalnum);
				//console.log(allprice);
				//总价计算
				var totalcost = 0;
				$(".zongjia").each(function(index, element) {
				   totalcost = totalcost +  parseFloat($(this).html());
				});
				var totalnum = 0;
				$(".num").each(function(index, element) {
				    totalnum = totalnum +  parseInt($(this).val());
				});
				
				//赋值
				var totalc = $(".twospan").html("￥"+totalcost+".00");
				var totaln = $(".onespan").html(parseInt(totalnum)+1);
				var allnum = $(this).parent().parent().parent().next();
				var url = "{:U('Shopcar/addNum')}";
				
					$.ajax({
					   type: "POST",
					   url: url,
					   data: "number="+number,
					   success: function(msg){
					   
						console.log(msg);
						
					   }
					});
			
		});
			
    </script>
    
    
</div>
</body>

<script src="__PUBLIC__/children/js/common.js"></script>
<script src="__PUBLIC__/children/js/cart.js"></script>
</html>
